<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('个人返宁情况')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <input th:type="hidden" th:value="${session.userid}" name="userid">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>返宁时间：</label>
                                <input type="text" class="time-input" placeholder="请选择返宁时间" name="fanningtime"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" href="/system/tianbao/fanningedit">
                    <i class="fa fa-plus"></i> 填报
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/fnryqk";

        $(function() {
            var options = {
                url: prefix + "/customlist",
                createUrl: prefix + "/add",
                removeUrl: prefix + "/remove",

                modalName: "fnryqk",
                columns: [
                {
                    field: 'keshiname',
                    title: '科室名称'
                },
                {
                    field: 'fanningshijian',
                    title: '返宁时间'
                },
                {
                    field: 'fnd',
                    title: '由何地返宁'
                },
                {
                    field: 'jiaotongfangshi',
                    title: '交通方式'
                },
                {
                    field: 'zgd',
                    title: '途经中高风险地'
                },
                {
                    field: 'yanse',
                    title: '健康码'
                },
                {
                    field: 'dianhua',
                    title: '电话'
                },
                {
                     field: 'zhuangtai',
                     title: '状态'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a style="float:right;" class="btn btn-danger btn-xs" onclick="remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
                ]
            };
            $.table.init(options);
        });

        function remove(ppId){

            $.ajax({
                type: "post",
                url:  "/system/fnryqk/remove",
                data: {
                    "ids": ppId
                },
                success: function(r) {
                    if (r.code == 0) {
                        if (confirm("删除成功")) {
                            location.href = '/system/tianbao/fanninglist';
                        }
                    } else {
                        alert(r.msg);
                    }
                }
            });
        }
    </script>
</body>
</html>